<?php

/**
 * Contact form base class.
 *
 * @package    form
 * @subpackage contact
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseContactForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                    => new sfWidgetFormInputHidden(),
      'position_title'        => new sfWidgetFormInput(),
      'work_unit'             => new sfWidgetFormInput(),
      'direct_line_modifier'  => new sfWidgetFormInput(),
      'direct_line_number'    => new sfWidgetFormInput(),
      'direct_line_extension' => new sfWidgetFormInput(),
      'person_id'             => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => true)),
      'created_at'            => new sfWidgetFormDateTime(),
      'updated_at'            => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                    => new sfValidatorDoctrineChoice(array('model' => 'Contact', 'column' => 'id', 'required' => false)),
      'position_title'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'work_unit'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'direct_line_modifier'  => new sfValidatorString(array('max_length' => 6, 'required' => false)),
      'direct_line_number'    => new sfValidatorString(array('max_length' => 12, 'required' => false)),
      'direct_line_extension' => new sfValidatorString(array('max_length' => 4, 'required' => false)),
      'person_id'             => new sfValidatorDoctrineChoice(array('model' => 'Person', 'required' => false)),
      'created_at'            => new sfValidatorDateTime(array('required' => false)),
      'updated_at'            => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('contact[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contact';
  }

}
